package com.geek.config.microprofile;

import com.geek.config.convert.StringConvert;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.spi.ConfigBuilder;
import org.eclipse.microprofile.config.spi.ConfigSource;
import org.eclipse.microprofile.config.spi.Converter;

public class DefaultConfigBuilder implements ConfigBuilder {


  private final ConfigSources configSources;
  private volatile boolean addDefaultConfigSource;

  public DefaultConfigBuilder(ClassLoader classLoader) {
    this.configSources = new ConfigSources(classLoader);
  }

  @Override
  public ConfigBuilder addDefaultSources() {
    configSources.addDefaultSources();
    return this;
  }

  @Override
  public ConfigBuilder addDiscoveredSources() {
    configSources.addDiscoveredSources();
    return this;
  }

  @Override
  public ConfigBuilder addDiscoveredConverters() {
    return this;
  }

  @Override
  public ConfigBuilder forClassLoader(ClassLoader classLoader) {
    return this;
  }

  @Override
  public ConfigBuilder withSources(ConfigSource... configSources) {
    return this;
  }

  @Override
  public ConfigBuilder withConverters(Converter<?>... converters) {
    return this;
  }

  @Override
  public <T> ConfigBuilder withConverter(Class<T> aClass, int i, Converter<T> converter) {
    return this;
  }

  @Override
  public Config build() {
    return new DefaultConfig(configSources, new StringConvert());
  }
}